/**
 * Copyright &copy; 2012-2016 <a href="https://www.kaaction.com">KAA</a> All rights reserved All rights reserved.
 */
package com.kaaction.modules.mer.service;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kaaction.common.service.TreeService;
import com.kaaction.common.utils.StringUtils;
import com.kaaction.modules.mer.entity.MerClassify;
import com.kaaction.modules.mer.dao.MerClassifyDao;

/**
 * 分类Service
 * @author huanghaiming
 * @version 2017-05-16
 */
@Service
@Transactional(readOnly = true)
public class MerClassifyService extends TreeService<MerClassifyDao, MerClassify> {

	public MerClassify get(String id) {
		return super.get(id);
		
	}
	
	public List<MerClassify> findList(MerClassify merClassify) {
		if (StringUtils.isNotBlank(merClassify.getParentIds())){
			merClassify.setParentIds(","+merClassify.getParentIds()+",");
		}
		return super.findList(merClassify);
	}
	
	@Transactional(readOnly = false)
	public void save(MerClassify merClassify) {
		
		if(StringUtils.isBlank(merClassify.getId())){
			merClassify.setIsSpecial("0");
		}
		super.save(merClassify);
	}
	
	@Transactional(readOnly = false)
	public void delete(MerClassify merClassify) {
		super.delete(merClassify);
	}

	public List<Map<String, Object>> selectClassify() {
		return super.dao.selectClassify();
	}

	public List<Map<String, Object>> selClassifySubset(String id) {
		return  super.dao.selClassifySubset(id);
	}
	
}